<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('核销员列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <label>用户名称：</label>
                            <input type="text" name="username"/>
                        </li>
                        <li>
                            <label>手机号：</label>
                            <input type="text" name="mobile"/>
                        </li>
                        <li>
                            <input type="hidden" name="role" value="0"/>
                        </li>
                        <li>
                            <label>微信号：</label>
                            <input type="text" name="wechat"/>
                        </li>

                        <li>
                            <label>账户状态：</label>
                            <select name="status" th:with="type=${@dict.getType('member_status')}">
                                <option value="">所有</option>
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                                        th:value="${dict.dictValue}"></option>
                            </select>
                        </li>

                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-primary single disabled" onclick="$.operate.edit()"
               shiro:hasPermission="system:member:edit">
                <i class="fa fa-edit"></i> 修改
            </a>
            <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:member:export">
                <i class="fa fa-download"></i> 导出
            </a>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('system:member:edit')}]];
    var removeFlag = [[${@permission.hasPermi('system:member:remove')}]];
    var roleDatas = [[${@dict.getType('member_role')}]];
    var sexDatas = [[${@dict.getType('member_sex')}]];
    var statusDatas = [[${@dict.getType('member_status')}]];
    var isExamineDatas = [[${@dict.getType('member_examine')}]];
    var isVipDatas = [[${@dict.getType('memeber_is_vip')}]];
    var prefix = ctx + "system/member";

    $(function () {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/editstaff/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "小程序用户",
            columns: [{
                checkbox: true
            },
                {
                    field: 'id',
                    title: '主键ID',
                    visible: false
                },
                {
                    field: 'memberCar',
                    title: '姓名',
                    formatter: function (value,row,index) {
                        if(value==null){
                            return "-";
                        }else{
                            return value.name;
                        }
                    }
                },
                {
                    field: 'memberCar',
                    title: '车牌号',
                    formatter: function (value,row,index) {
                        if(value==null){
                            return "未绑定";
                        }else{
                            return value.licensePlate;
                        }
                    }
                },
                {
                    field: 'memberCar',
                    title: '车架号',
                    formatter: function (value,row,index) {
                        if(value==null){
                            return "未绑定";
                        }else{
                            return value.frameNo;
                        }
                    }
                },
                {
                    field: 'mobile',
                    title: '手机号'
                },
                {
                    field: 'role',
                    title: '角色',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(roleDatas, value);
                    }
                },
                {
                    field: 'wechat',
                    title: '微信号'
                },
                {
                    field: 'sex',
                    title: '性别',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(sexDatas, value);
                    }
                },
                /*{
                    field: 'headpic',
                    title: '用户头像',
                    formatter: function (value, row, index) {
                        if (value != null && value != '') {
                            return '<img src="' + value + '" style="width:80px;" >';
                        }
                        return '';
                    }
                },*/
                {
                    field: 'status',
                    title: '账户状态',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(statusDatas, value);
                    }
                },
                {
                    field: 'recommendNum',
                    title: '推荐人数量'
                },
                {
                    field: 'memeberNo',
                    title: '工号'
                },
                {
                    field: 'created',
                    title: '注册时间'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        // actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="send(\'' + row.id + '\')"><i class="fa fa-edit"></i>发券</a> ');
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });


    function send(id) {
        $.modal.open("优惠券列表", ctx+"system/member/couponlist/"+id);
    }
</script>
</body>
</html>